package com.filesystem.file.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.filesystem.file.entity.Files;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.filesystem.file.entity.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.io.File;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author JayZhou
 * @since 2021-06-10
 */
@Mapper
public interface  FileMapper extends BaseMapper<Files> {

    //@Select("SELECT * FROM files WHERE username = #{username}" )
    //List<Files> userListFile(String username );

    @Select("SELECT * FROM files WHERE username = #{username} LIMIT #{page} , #{limit}" )
     List<Files> userListFile(String username ,int page ,int limit);


    /**
     * 将数据信息插入到数据库
     * @param files 对象
     */
    //@Insert("insert into files(filename,filepath,filesuffix) values( #{filepath} , #{filename} ,#{filesuffix}")
    void insertFile(Files files);

    /**
     * 根据id获取文件
     * @param id
     * @return
     */
    @Select("select * from files where id=#{id}")
    Files selectFileById(String id);





}
